<?php


namespace app\admin\controller;


class School extends Base
{
    public function index()
    {
        if(request()->isAjax()) {
            $data = input('post.');
            try{
                $_add_res = Model('About')->save(['content'=>$data['content']],['id'=>'1']);
            }catch (\Exception $e) {
                return show('200',$e->getMessage(),'0');
            }
            if(!$_add_res) {
                return show('200','数据库错误','0');
            }
            return show('200','添加成功，刷新父页面生效','1');
        }else {
            $this_data = Model('About')->get(['id' => '1']);
            $this->assign([
                'this_data' => $this_data
            ]);
            return $this->fetch();
        }
    }
}